package com.lijun.SpringBootJavaFX.utils;

import javafx.scene.control.Control;

/**
 * 获取组建坐标及大小的工具方法
 */
public class GetScreen {
    /**
     *
     * @param control
     * @return
     */
    public static double getScreenX(Control control){
        return control.getScene().getWindow().getX()+control.getScene().getX()+ control.localToScene(0, 0).getX();
    }
    public static double getScreenY(Control control){
        return control.getScene().getWindow().getY()+control.getScene().getY()+ control.localToScene(0, 0).getY();
    }
    public static double getWidth(Control control){
        return control.getBoundsInParent().getWidth();
    }
    public static double getHeight(Control control){
        return control.getBoundsInParent().getHeight();
    }
}